package 预科0102Phone;
/*上网套餐类 特征：上网流量、每月资费 行为：显示所有套餐信息 */
public class DataPlan extends PhonePlan implements DataService{
	private float netFlow;
	//构造方法

	public DataPlan(float netFlow,int cost) {
		super();
		this.netFlow = netFlow;
		this.cost = cost;
	}
	public DataPlan() {
	}
	public float getNetFlow() {
		return netFlow;
	}
	public void setNetFlow(float netFlow) {
		this.netFlow = netFlow;
	}
	//重写show方法
	public void show() {
		System.out.println("套餐信息：当前套餐上网流量为"+this.getNetFlow()+" 每月资费为"+this.getCost());
	}
	//重写上网服务方法
	@Override
	public void dataService(float netFlow,PhoneCard card ) {
		System.out.println("上网服务：用户"+card.getName()+"卡号"+card.getCardNum()+"上网"+netFlow+"M流量");
		card.setNetFlow(card.getNetFlow()+netFlow);
		this.netFlow=this.netFlow-netFlow;
		//卡消费金额
		card.setRemainder(card.getRemainder()-this.cost);
		
	}

	
	
}
